function fn(){
    let flag = true
      $("#yj").click(function(){
        if(flag){
          $("#password").attr("type","text")
          $("#yj").removeClass("icon-yanjing_yincang")
          $("#yj").addClass("icon-yanjing_xianshi")
          flag = false
        }else{
          $("#password").attr("type","password")
          $("#yj").removeClass("icon-yanjing_xianshi")
          $("#yj").addClass("icon-yanjing_yincang")
          flag = true
        }
      })
}
fn()

function login(){
    const username = document.getElementById("username").value
    const password = document.getElementById("password").value
    console.log(username,password);
    if(!(/^\w{6,16}$/i.test(username)&& /^\w{6,16}$/i.test(password))){
        return alert("请输入正确的账号和密码")
    }
    Ajax({
        type:"POST",
        url:"http://localhost/lin/server/login.php",
        data:{username,password},
        success(msg){
            console.log(msg);
            sessionStorage.setItem("userInfo",msg)
            if(msg != "false"){
                sessionStorage.setItem("login",true)
                location.href = "../html/SystemHomepage.html";
            }else{
                alert("账号或者密码错误")
                location.reload()
            }
        }
    })
}

function wenzi(){
    setInterval(function () {
        const show = document.querySelector("span[data-show]");
        const next =
            show.nextElementSibling || document.querySelector("span:first-child");
        const up = document.querySelector("span[data-up]");
    
        if (up) {
            up.removeAttribute("data-up");
        }
        show.removeAttribute("data-show");
        show.setAttribute("data-up", "");
        next.setAttribute("data-show", "");
    }, 2000);
    const show = document.querySelector("span[data-show]")
    const up = document.querySelector("span[data-up]")    
}
wenzi()
        



